/*
* Copyright (C) 2012-2014 qar
* License: http://www.gnu.org/licenses/gpl.html GPL version 2
*/

#ifndef ENCRYPTORAES_H
#define ENCRYPTORAES_H

#include <QtCore>

#include "crypto/ciphers/encryptor.h"

struct aes_ctx;

class EncryptorAes : public Encryptor
{
public:
	EncryptorAes(QByteArray key, QByteArray iv = QByteArray());
	virtual ~EncryptorAes();

	virtual qint64 blockSize() const;
	virtual qint64 keySize() const;
	virtual QString getAlgorithmName() const;

	virtual void encrypt(const QByteArray &clearText, QByteArray &cipherText);

	virtual void decrypt(const QByteArray &cipherText, QByteArray &clearText);

	virtual bool toStream(QDataStream &);
	virtual bool fromStream(QDataStream &);

private:
	struct aes_ctx *ctx;
	QByteArray key;
	QByteArray iv;
};

#endif // ENCRYPTORAES_H
